-module(pt_wait_info_b001).
-include("pt.hrl").

-export([new/0,from_binary/1,to_binary/1,to_binary/2,get_id/0]).

get_id()-> 16#B001.

new()->#pt_wait_info{}.

from_binary(Binary) -> 
	{Binary1,Data1} = lib_protocol:from_binary(Binary,uint32),
	{Binary2,Data2} = lib_protocol:from_binary(Binary1,uint32),
	{Binary3,Data3} = lib_protocol:from_binary(Binary2,string),
	{Binary4,Data4} = lib_protocol:from_binary(Binary3,string),
	{Binary5,Data5} = lib_protocol:from_binary(Binary4,uint32),
	{Binary6,Data6} = lib_protocol:from_binary(Binary5,uint8),
	{Binary7,Data7} = lib_protocol:from_binary(Binary6,{list,wait_player_from_binary}),
	{Binary8,Data8} = lib_protocol:from_binary(Binary7,uint8),
	{Binary9,Data9} = lib_protocol:from_binary(Binary8,uint8),
	{Binary10,Data10} = lib_protocol:from_binary(Binary9,uint8),
	{Binary11,Data11} = lib_protocol:from_binary(Binary10,uint8),
	{_Binary,Data12} = lib_protocol:from_binary(Binary11,uint32),
	#pt_wait_info{
		room_id = Data1,
		room_type = Data2,
		room_rule = Data3,
		room_psw = Data4,
		room_create = Data5,
		room_score = Data6,
		room_players = Data7,
		ply_mode = Data8,
		cur_times = Data9,
		max_times = Data10,
		room_game_status = Data11,
		zhuang_jia_aid = Data12
	}.

to_binary(Pt) -> to_binary(Pt,0).
to_binary(Pt,Seq) -> 
	Data1 = lib_protocol:to_binary(Pt#pt_wait_info.room_id,uint32),
	Data2 = lib_protocol:to_binary(Pt#pt_wait_info.room_type,uint32),
	Data3 = lib_protocol:to_binary(Pt#pt_wait_info.room_rule,string),
	Data4 = lib_protocol:to_binary(Pt#pt_wait_info.room_psw,string),
	Data5 = lib_protocol:to_binary(Pt#pt_wait_info.room_create,uint32),
	Data6 = lib_protocol:to_binary(Pt#pt_wait_info.room_score,uint8),
	Data7 = lib_protocol:to_binary(Pt#pt_wait_info.room_players,{list,wait_player_to_binary}),
	Data8 = lib_protocol:to_binary(Pt#pt_wait_info.ply_mode,uint8),
	Data9 = lib_protocol:to_binary(Pt#pt_wait_info.cur_times,uint8),
	Data10 = lib_protocol:to_binary(Pt#pt_wait_info.max_times,uint8),
	Data11 = lib_protocol:to_binary(Pt#pt_wait_info.room_game_status,uint8),
	Data12 = lib_protocol:to_binary(Pt#pt_wait_info.zhuang_jia_aid,uint32),
	GetData = <<Data1/binary,Data2/binary,Data3/binary,Data4/binary,Data5/binary,Data6/binary,Data7/binary,Data8/binary,Data9/binary,Data10/binary,Data11/binary,Data12/binary>>,
	lib_protocol:make_pt(GetData,get_id(),Seq).

